package com.cloud.phone.broadcastReceiver

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.blankj.utilcode.util.LogUtils
import com.cloud.phone.constants.Constants
import com.cloud.phone.utils.AppUtils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch

/**
 * @auth: njb
 * @date: 2024/4/22 11:31
 * @desc: 应用被杀死广播
 */
class CloudKillAppBroadcastReceiver : BroadcastReceiver() {
    private val TAG = "AppKilled"
    override fun onReceive(context: Context, intent: Intent?) {
        when {
            intent?.action.equals(Constants.ACTION_APP_KILLED) -> {
                val packageName = intent?.getStringExtra("package")
                val reason = intent?.getStringExtra("reason")
                LogUtils.d(TAG, "package: $packageName")
                LogUtils.d(TAG, "reason: $reason")
            }
        }
    }
}